import axios from 'axios';

/**
 *
 * @description 获取品牌数据/模糊搜索
 * @param {string} pid 项目id
 * @param {string} searchVal 需要检索的文字
 * @returns
 */
export const getShopServer = (pid, searchVal) => {
    const url = searchVal ? `https://openapi.cloudindoormap.com:8085/ids/getShops?pid=${pid}&lan=sc&serkey=${searchVal}` : `https://openapi.cloudindoormap.com:8085/ids/getShops?pid=${pid}&lan=sc&serkey=`;
    return new Promise((resolve, reject) => {
        axios.get(url).then(res => {
            resolve(res);
        }).catch(error => {
            reject(error);
        })
    })

}

/**
 *
 * @description 获取业态接口
 * @param {string} pid 项目id
 * @returns
 */
export const getFormatServer = (pid) => {
    const url = `https://openapi.cloudindoormap.com:8085/mapQuery/getMapBrandType?pid=${pid}&secretKey=sk8whhan6tc985rh211jk`;
    return new Promise((resolve, reject) => {
        axios.get(url).then(res => {
            resolve(res);
        }).catch(error => {
            reject(error);
        })
    })
}